package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	//	"strings"
)

// gcd ...
func gcd(a, b int) int {
	if b > a {
		a, b = b, a
	}
	if a%b == 0 {
		return b
	}
	return gcd(b, a%b)
}

// lcm ...
func lcm(a, b int) int {
	g := gcd(a, b)
	return (a / g) * b
}

func main() {
	sc := NewScanner()

	n := sc.NextInt()
	tmp := sc.NextInt()
	for i := 1; i < n; i++ {
		tmp = gcd(tmp, sc.NextInt())
	}
	fmt.Printf("%v\n", tmp)

}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			result = append(result, v)
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	result = append(result, v)

	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024*1024), bufio.MaxScanTokenSize)
}

func nextString() string {
	sc.Scan()
	return sc.Text()
}

func nextFloat() float64 {
	sc.Scan()
	f, e := strconv.ParseFloat(sc.Text(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func scanInts(n int) []int {
	is := make([]int, n)
	for i := 0; i < n; i++ {
		is[i] = nextInt()
	}
	return is
}

func main() {
	N := nextInt()
	IS := scanInts(N)
	sort.Sort(sort.IntSlice(IS))
	for {
		if len(IS) == 1 {
			fmt.Println(IS[0])
			return
		}
		if IS[0] == IS[1] {
			IS = IS[1:]
			continue
		} else if IS[0] == 1 {
			fmt.Println(1)
			return
		}
		a := IS[1] - IS[0]
		b := IS[0]
		IS[1] = max(a, b)
		IS[0] = min(a, b)
	}
}

func min(a, b int) int {
	if a < b {
		return a
	} else {
		return b
	}
}

func max(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}


package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024*1024), bufio.MaxScanTokenSize)
}

func nextString() string {
	sc.Scan()
	return sc.Text()
}

func nextFloat() float64 {
	sc.Scan()
	f, e := strconv.ParseFloat(sc.Text(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func scanInts(n int) []int {
	is := make([]int, n)
	for i := 0; i < n; i++ {
		is[i] = nextInt()
	}
	return is
}

func main() {
	N := nextInt()
	IS := scanInts(N)
	sort.Sort(sort.IntSlice(IS))
	for {
		if IS[0] == IS[1] {
			IS = IS[1:]
			continue
		} else if IS[0] == 1 {
			fmt.Println(1)
			return
		}
		a := IS[1] - IS[0]
		b := IS[0]
		IS[1] = max(a, b)
		IS[0] = min(a, b)
	}
}

func min(a, b int) int {
	if a < b {
		return a
	} else {
		return b
	}
}

func max(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}


package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024*1024), bufio.MaxScanTokenSize)
}

func nextString() string {
	sc.Scan()
	return sc.Text()
}

func nextFloat() float64 {
	sc.Scan()
	f, e := strconv.ParseFloat(sc.Text(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func scanInts(n int) []int {
	is := make([]int, n)
	for i := 0; i < n; i++ {
		is[i] = nextInt()
	}
	return is
}

func main() {
	N := nextInt()
	IS := scanInts(N)
	sort.Sort(sort.IntSlice(IS))
	for {
		if IS[0] == IS[1] {
			fmt.Println(IS[0])
			return
		} else if IS[0] == 1 {
			fmt.Println(1)
			return
		}
		a := IS[1] - IS[0]
		b := IS[0]
		IS[1] = max(a, b)
		IS[0] = min(a, b)
	}
}

func min(a, b int) int {
	if a < b {
		return a
	} else {
		return b
	}
}

func max(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}


gets;p gets.split.map(&:to_i).inject(:gcd)


n = gets.to_i
a = gets.split.map(&:to_i)

puts a.inject(:gcd)


n = gets.to_i
a = gets.split.map(&:to_i)

p a.inject(:gcd)


def GCD(m, n)
	return 0 if m == 0 || n == 0
	while m != 0 && n != 0
		if m > n then
			m %= n
		else
			n %= m
		end
	end
	return [m, n].max
end

def LCM(m, n)
	return 0 if m == 0 || n == 0
	return m * n / GCD(m, n)
end

n = gets.chomp.to_i
arr = gets.chomp.split.map(&:to_i).sort
mod = arr[0]
1.upto(n-1) do |i|
	ngo = arr[i] % mod
	mod = ngo if ngo < mod && ngo > 0
end

puts mod


n=gets.to_i
a=gets.split.map(&:to_i)
v=a.uniq!
if v.length==1
    p a[0]
    exit
end

odd=0
even=0

for i in 0..a.length-1
    if odd==1 && even==1
        p 1
        exit
    end

    if a[i]%2==1
        odd=1
    else
    even=1
    end
end

p 2


n=gets.to_i
a=gets.split.map(&:to_i)
v=a.uniq
if v.length==1
p a[0]
exit
end
a.sort!
while true
    first=a[0]
    second=a[1]
    v=(first-second).abs
    if a.count(v)==0
        a.push(v)
        a.sort!
    else
    break
    end
end
p a[0]


fn read<T: std::str::FromStr>(
    stdin_lock: &mut std::io::StdinLock,
    buf: &mut Vec<u8>,
    delimiter: u8,
) -> T {
    buf.clear();
    let l = std::io::BufRead::read_until(stdin_lock, delimiter, buf).unwrap();
    buf.truncate(l - 1); // remove delimiter
    let s = unsafe { std::str::from_utf8_unchecked(&buf) };
    s.parse().unwrap_or_else(|_| panic!("read"))
}

fn gcd(a: i32, b: i32) -> i32 {
    fn gcd1(m: i32, n: i32) -> i32 {
        if n == 0 {
            m
        } else {
            gcd1(n, m % n)
        }
    }
    if a > b {
        gcd1(a, b)
    } else {
        gcd1(b, a)
    }
}

fn main() {
    let stdin = std::io::stdin();
    let mut stdin_lock = stdin.lock();
    let mut buf: Vec<u8> = Vec::new();
    let n: usize = read(&mut stdin_lock, &mut buf, b'\n');
    let mut av = vec![0i32; n];
    for i in 0..n - 1 {
        av[i] = read(&mut stdin_lock, &mut buf, b' ');
    }
    av[n - 1] = read(&mut stdin_lock, &mut buf, b'\n');

    let mut ans = av[0];
    for i in 1..n {
        ans = gcd(ans, av[i]);
    }
    println!("{}", ans);
}


/*------------------------------------------------------------------*/
/*------------------------- begin template -------------------------*/
/*------------------------------------------------------------------*/

// ref: tanakh <https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8>
// diff: using Parser
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut parser = Parser::from_str($s);
        input_inner!{parser, $($r)*}
    };
    (parser = $parser:ident, $($r:tt)*) => {
        input_inner!{$parser, $($r)*}
    };
    (new_stdin_parser = $parser:ident, $($r:tt)*) => {
        let stdin = std::io::stdin();
        let reader = std::io::BufReader::new(stdin.lock());
        let mut $parser = Parser::new(reader);
        input_inner!{$parser, $($r)*}
    };
    ($($r:tt)*) => {
        input!{new_stdin_parser = parser, $($r)*}
    };
}

macro_rules! input_inner {
    ($parser:ident) => {};
    ($parser:ident, ) => {};
    ($parser:ident, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($parser, $t);
        input_inner!{$parser $($r)*}
    };
}

macro_rules! read_value {
    ($parser:ident, ( $($t:tt),* )) => {
        ( $(read_value!($parser, $t)),* )
    };
    ($parser:ident, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($parser, $t)).collect::<Vec<_>>()
    };
    ($parser:ident, chars) => {
        read_value!($parser, String).chars().collect::<Vec<char>>()
    };
    ($parser:ident, usize1) => {
        read_value!($parser, usize) - 1
    };
    ($parser:ident, $t:ty) => {
        $parser.next::<$t>().expect("Parse error")
    };
}

use std::io;
use std::io::BufRead;
use std::str;

// ref: tatsuya6502 <https://qiita.com/tatsuya6502/items/cd448486f7ef7b5b8c7e>
// ref: wariuni <https://qiita.com/tatsuya6502/items/cd448486f7ef7b5b8c7e#comment-7040a5ae96305e884eb9>
// diff: using std::io::BufRead::fill_buf()
pub struct Parser<R> {
    reader: R,
    buf: Vec<u8>,
    pos: usize,
}

impl Parser<io::Empty> {
    pub fn from_str(s: &str) -> Parser<io::Empty> {
        Parser {
            reader: io::empty(),
            buf: s.as_bytes().to_vec(),
            pos: 0,
        }
    }
}

impl<R: BufRead> Parser<R> {
    pub fn new(reader: R) -> Parser<R> {
        Parser {
            reader: reader,
            buf: vec![],
            pos: 0,
        }
    }
    pub fn update_buf(&mut self) {
        self.buf.clear();
        self.pos = 0;
        loop {
            let (len, complete) = {
                let buf2 = self.reader.fill_buf().unwrap();
                self.buf.extend_from_slice(buf2);
                let len = buf2.len();
                (len, buf2[len - 1] <= 0x20)
            };
            self.reader.consume(len);
            if complete {
                break;
            }
        }
    }
    pub fn next<T: str::FromStr>(&mut self) -> Result<T, T::Err> {
        loop {
            let mut begin = self.pos;
            while begin < self.buf.len() && (self.buf[begin] <= 0x20) {
                begin += 1;
            }
            let mut end = begin;
            while end < self.buf.len() && (self.buf[end] > 0x20) {
                end += 1;
            }
            if begin != self.buf.len() {
                self.pos = end;
                return unsafe { str::from_utf8_unchecked(&self.buf[begin..end]) }.parse::<T>();
            } else {
                self.update_buf();
            }
        }
    }
}

pub fn gcd<T>(x: T, y: T) -> T
where
    T: PartialEq + Copy + std::ops::Rem<Output = T> + std::convert::From<u8>,
{
    if y == T::from(0u8) {
        x
    } else {
        gcd(y, x % y)
    }
}

fn main() {
    input! {
        new_stdin_parser = parser,
    }
    let res = solve(&mut parser);
    print!("{}", res);
}

/*------------------------------------------------------------------*/
/*-------------------------- end template --------------------------*/
/*------------------------------------------------------------------*/

use std::fmt::Write;
fn solve<R: BufRead>(parser: &mut Parser<R>) -> String {
    let mut buf = String::new();
    input! {
        parser = parser,
        n: usize,
        xs: [i64; n],
    }
    let mut res = xs[0];
    for i in 1..n {
        res = gcd(res, xs[i]);
    }
    writeln!(buf, "{}", res);
    buf
}


use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: usize,
        a: [u128; n]
    };

    let mut a: Vec<u128> = a;
    a.sort();
    a.dedup();

    let mut result = a[0];

    if a.len() > 1 {
        for i in 1..n {
            result = gdg(result, a[i]);
        }
    }

    println!("{}", result)
}

fn gdg(a: u128, b: u128) -> u128 {
    let mut a = a;
    let mut b = b;

    if a > b {
        let tmp = a;
        a = b;
        b = tmp;
    }

    let mut r = a % b;

    while r != 0 {
        a = b;
        b = r;
        r = a % b;
    }

    return b;
}


use proconio::{input, fastout};
#[fastout]
fn main() {
    input!{
        n: usize,
        mut a: [usize;n],
    }

    a.sort();
    for i in 0..n {
        if a[i]%a[0]!=0 {
            println!("1");
            return;
        }
    }
    println!("{}", a[0]);
}


use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn gcd(x: i64, y: i64) -> i64 {
    if y == 0 {
        x
    } else {
        gcd(y, x % y)
    }
}

fn main() {
    let n: usize = read();
    let mut a: Vec<i64> = vec![];
    for _ in 0..n {
        a.push(read());
    }

    let ans = a[0];

    for i in 0..a.len() {
        let ai = a[i];
        gcd(ai, ans);
    }
    println!("{}", ans);
}


import Foundation
//最大公約数を求める関数
func gcd(_ num1: Int, _ num2: Int) -> Int {
   let r = num1 % num2
   if r != 0 {
       return gcd(num2, r)
   } else {
       return num2
   }
}
//３つ以上の数の最大公約数を求める
func gcdArr(_ numArr: [Int]) -> Int {
    var ans: Int = numArr[0]
    for i in numArr {
        ans = gcd(ans, i)
    }
    return ans
}

//最小公倍数を求める関数
func lcm(_ num1: Int, _ num2: Int) -> Int {

    var gcdNum = gcd(num1, num2)
    return num1*num2/gcdNum
}

//３つ以上の最大公約数を求める
func lcmArr(_ numArr: [Int]) -> Int {
    var ans: Int = 1
    for i in numArr {
        ans = lcm(ans, i)
    }
    return ans
}

let ri = Int(readLine()!)!
let ra = readLine()!.split(separator: " ").map({Int($0)!})
print(gcdArr(ra))


// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func readInt() -> Int {
    return Int(readLine()!)!
}

func readDoubles () -> [Double] {
    return readLine()!.split(separator: " ").map { Double($0)! }
}

func readDouble() -> Double{
    return Double(readLine()!)!
}
///最大公約数を返す
func gcd(_ m:Int, _ n:Int) -> Int {
    if n == 0 {return m}
    return gcd(n, m % n)
}
///最小公倍数を返す
func lcm(_ m:Int, _ n:Int) -> Int {
    return m * n / gcd(m, n)
}

///素数判定(試し割り)
func isPrime(_ x:Int) -> Bool {
    if x <= 1 || x % 2 == 0 { return false }
    if x == 2 { return true }
    for i in stride(from: 3, to: Int(ceil(sqrt(Double(x)))), by: 2){
        if x % i == 0 {
            return false
        }
    }
    return true
}

//https://program-life.com/669
///実行速度の計測
func exectionTime(action: () -> Void) {
    let startDate = Date()
    action()
    let endDate = Date()
    print(endDate.timeIntervalSince(startDate))
}

// https://melheaven.hatenadiary.jp/entry/atcoder144
///約数の配列を返す
func makeDivisors(_ n:Int) -> [Int] {
    var divisors = [Int]()
    for i in 1..<Int(pow(Double(n), 0.5)) + 1 {
        if n % i == 0{
            divisors.append(i + n / i)
        }
    }

    return divisors
}

//https://riptutorial.com/ja/swift/example/14738/インデックスを知らずに配列から要素を削除する
extension Array where Element: Equatable {

    mutating func remove(_ element: Element) {
        _ = firstIndex(of: element).flatMap {
            self.remove(at: $0)
        }
    }
}

func binarySearch(rifgt:Int, key:Int, ary:[String]) -> Int{
    var left = 0
    var right = rifgt

    while abs(right - left) > 1 {
        let mid = left + (right - left) / 2

        if Int(ary[mid])! < key {
            left = mid

        } else {
            right = mid
        }
    }
    return left
}

func arrangement (prev:String, ary:[String], returnVal:[String]) -> [String] {
    var returnVal = returnVal
    if ary.count == 0 {
        returnVal.append(prev)
        return returnVal
    }

    for s in ary {
        let wprev = prev + s
        var wary = ary
        wary.remove(s)
        returnVal = arrangement(prev: wprev, ary: wary, returnVal: returnVal)
    }
    return returnVal
}

func main() {
    let n = readInt()
    var aryA = readInts().sorted()
    var mi = Int.max
    //＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿ここまで入力
    for i in 1..<n {
        let surplus = aryA[i] % aryA[0]
        if surplus > 0 {
            mi = min(mi, surplus)
        }
    }

    while aryA[0] > 1 && mi > 1 && mi < Int.max{
        if aryA[0] > mi {
            aryA[0] = aryA[0] - mi
        }
        else {
            mi = mi - aryA[0]
        }
    }
    print(aryA[0] > 0 && mi > 0 ? min(aryA[0], mi): max(aryA[0], mi))
}
main()


// ユークリッドの互除法
func gcd(_ x: Int, _ y: Int) -> Int {
    if y == 0 { return x }
    return gcd(y, x % y)
}
// 再帰関数
func recursiveFunc(_ idx: Int, _ x: Int) {
    if idx == N-1 {
        print(x)
        return
    }
    recursiveFunc(idx+1, gcd(x, A[idx+1]))
}

let N = Int(readLine()!)!
let A: [Int] = readLine()!.split(separator: " ").map { Int($0)! }

recursiveFunc(1, gcd(A[0], A[1]))   // (๑•ૅㅁ•๑)


import Foundation
//最大公約数を求める関数
func gcd(_ num1: Int, _ num2: Int) -> Int {
   let r = num1 % num2
   if r != 0 {
       return gcd(num2, r)
   } else {
       return num2
   }
}
//３つ以上の数の最大公約数を求める
func gcdArr(_ numArr: [Int]) -> Int {
    var ans: Int = numArr[0]
    for i in numArr {
        ans = gcd(ans, i)
    }
    return ans
}

//最小公倍数を求める関数
func lcm(_ num1: Int, _ num2: Int) -> Int {

    var gcdNum = gcd(num1, num2)
    return num1*num2/gcdNum
}

//３つ以上の最大公約数を求める
func lcmArr(_ numArr: [Int]) -> Int {
    var ans: Int = 1
    for i in numArr {
        ans = lcm(ans, i)
    }
    return ans
}

let ri = Int(readLine()!)!
let ra = readLine()!.split(separator: " ").map({Int($0)!})
print(lcmArr(ra))


const input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);let input_i=-1;const tn=():number=>{input_i++;return Number(input[input_i])};const tnn=(n:number):number[]=>{const a=[];for(let i=0;i<n;i++){a.push(tn())}return a};const ts=():string=>{input_i++;return String(input[input_i])};const tss=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(ts())}return a};const to=(...arg)=>{console.log(...arg)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const floor=(a)=>{return Math.floor(a)};const ceil=(a)=>{return Math.ceil(a)};const asc=(ar:number[])=>{const t=[...ar];return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{const t=[...ar];return t.sort((a,b)=>{return b-a})};const sw=(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length-1;i+=2){if(eval(a+op+arr[i])){return arr[i+1]}}return arr[arr.length-1]};const near=(n:number,arr:number[]):number=>{let ne=arr[0],ni=0;for(let i=1;i<arr.length;i++){if(Math.abs(n-ne)>Math.abs(n-arr[i])){ne=arr[i];ni=i}}return ni};const deduplicate=(a:any[]):any[]=>{return Array.from(new Set(a))};const gcd=(x,y)=>{while(y){[x,y]=[y,x%y]}return x};const sum=(arr)=>{return arr.reduce((a,b)=>a+b);};const isPrime=(n:number):boolean=>{if(n<2)return false;const suq=Math.sqrt(n);for(let i=2;i<=suq;i++){if(n%i==0){return false;}}return true;};
const main=()=>{
  let n=tn(),ar=tnn(n),ans=ar[0]
  for(let i=1;i<n;i++){
    ans=gcd(ar[i],ans)
  }
  to(ans)
}
main()


function main(input) {
  input = input.trim().split("\n");
  const n = Number(input[0]);
  const a = input[1].split(" ").map(n => Number(n));
  const gcd = (a, b) => {
    if (b === 0) return a;
    return gcd(b, a % b);
  }
  let result = a[0];
  for (let i = 1; i < n; i++) {
  	result = gcd(result, a[i]);
  }
  console.log(result);
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));


export class Main {
  static main(input: string): string {
    const [nStr, aStr] = input.split("\n");
    const n = Number(nStr);
    const aList = aStr.split(" ").slice(0, n).map(Number);
    let result = Main.gcd(aList[0], aList[1]);
    for (let i = 2; i < n; i++) {
      if (result == 1) {
        break;
      }
      result = Main.gcd(result, aList[i]);
    }
    return `${result}`;
  }

  private static gcd(a: number, b: number): number {
    if (a == 0 || b == 0) {
      return 0;
    }
    let r = a;
    let tmp = b;
    while (tmp > 0) {
      let t = r % tmp;
      r = tmp;
      tmp = t;
    }
    return r;
  }
}
console.log(Main.main(require("fs").readFileSync("/dev/stdin", "utf8")));


const stdin = require('fs').readFileSync('/dev/stdin', 'utf8')

const _n = stdin.split('\n')[0]
const n = Number(_n)

let a = stdin.split('\n')[1].split(' ').map(Number)

a.forEach((e,i)=>{
  for(let j = 0; j < a.length; j++){
    if(j !== i){
      const m = e >= a[j] ? e % a[j] : 0
      if(m){
        a[i] = m
      }
    }
  }
})

a.sort((A,B)=>A-B)
console.log(a[0])


function main(arg) {
  const _a: string[] = arg.split("\n")
  const _n: number = Number(_a[0])
  const _m: string[] = _a[1].split(" ")
  let list: number[] = []

  for (let i = 0; i < _m.length;i++) {
    list.push(Number(_m[i]))
  }

  while (list.length != 1){
    let min: number = list.reduce((a, b) => a < b ? a : b)

    if (min == 1) return console.log(min)

    for (let i = 0; i < Number(_n); i++) {
      if (list[i] - Math.floor(list[i] / min) * min > 0){
        list[i] = list[i] - Math.floor(list[i] / min) * min
      }
    };

    list = list.filter(function (x, i, self) {
      return self.indexOf(x) === i;
    });
  }

  return console.log(list[0])
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


import sys

def main():
    s = sys.stdin.readline().rstrip()

    black = 0
    ans = 0

    for i in s:
        if i == "B":
            black = black + 1
        else:
            ans = ans + black

    print(ans)

if __name__ == "__main__":
    main()


def main():
    S=input()
    b_n = 0; ans = 0
    for s in S:
        if s=='B': b_n += 1
        else: ans += b_n
    print(ans)
main()


S = input()

def f(S):
    if len(S)==1 :
        return 0
    else :
        result = 0; b = 0
        for i in S :
            if i == 'B' :
                b+=1
            else:
                result += b
        return result
print(f(S))


def resolve():
    S = input()
    sub = "BW"
    cnt = 0
    st = S.find("B")
    S = S[st:]
    while True:
        res = S.find(sub)
        if res == -1:
            break
        cnt += 1
        S = S[:res] + "WB" + S[res+2:]
    print(cnt)

if __name__ == "__main__":
    resolve()


def resolve():
    S = input()
    sub = "BW"
    cnt = 0
    while True:
        res = S.find(sub)
        if res == -1:
            break
        cnt += 1
        S = S[:res] + "WB" + S[res+2:]
    print(cnt)

if __name__ == "__main__":
    resolve()


import sys
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7

s = S()

# n個のオセロストーンが1列にある。長さnの文字列sで石の状態はあらわされていて、
# i番目の石が白：w、黒:bであらわされている。
# 以下の操作を行う

# iがb,i+1がwなiを一つ選び、二つとも裏返す。

# 最大でこの作業を何回行うことができるか。

# 例
# bwbwbwbwbw ⇒ wbwbwbwbwb
# bwwbbbwwwbwb　⇒　wbwbbbwwwbwb　⇒ wwbbbwwwbwb　⇒ wwbbwbwwbwb　⇒ wwbwbbwwbwb　⇒
# wwwbbbwwbwb　⇒ wwwbbwbwbwb　⇒ wwwbwbbwbwb　⇒ wwwwbbbwbwb　⇒ wwwwbbbwbwb　⇒

# 最終的にwwwwwwbbbbbになるので、結論としてはwを左に動かした回数をカウントすればよい。
# このカウントは、左から見て行ってwが出た位置より左のbの数を足し上げればよい。
black = 0
ans = 0
for stone in s:
    if stone == "b":
        black = black + 1
    else:
        ans = ans + black
print(ans)


import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) throws IOException {
        InputStream in = System.in;
        final byte[] buffer = new byte[200001];
        int buflen = 0;
        buflen = in.read(buffer);
        int c=0;
        long s=0;
        for (int i=0; i<buflen; ++i) {
            if (buffer[i]=='B') {
                ++c;
            } else if (buffer[i]=='W') {
                s+=c;
            }
        }
       	System.out.println(s);
    }
}


import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;

public class Main {
	static InputStream is;
	static PrintWriter out;
	static String INPUT = "";

	static void solve()
	{
		char[] s = ns().toCharArray();
		int n = s.length;
		int p = 0;
		long ans = 0;
		for(int i = 0;i < n;i++){
			if(s[i] == 'W'){
				ans += i-p;
				p++;
			}
		}
		out.println(ans);
	}

	public static void main(String[] args) throws Exception
	{
		long S = System.currentTimeMillis();
		is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		solve();
		out.flush();
		long G = System.currentTimeMillis();
		tr(G-S+"ms");
	}

	private static boolean eof()
	{
		if(lenbuf == -1)return true;
		int lptr = ptrbuf;
		while(lptr < lenbuf)if(!isSpaceChar(inbuf[lptr++]))return false;

		try {
			is.mark(1000);
			while(true){
				int b = is.read();
				if(b == -1){
					is.reset();
					return true;
				}else if(!isSpaceChar(b)){
					is.reset();
					return false;
				}
			}
		} catch (IOException e) {
			return true;
		}
	}

	private static byte[] inbuf = new byte[1024];
	static int lenbuf = 0, ptrbuf = 0;

	private static int readByte()
	{
		if(lenbuf == -1)throw new InputMismatchException();
		if(ptrbuf >= lenbuf){
			ptrbuf = 0;
			try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
			if(lenbuf <= 0)return -1;
		}
		return inbuf[ptrbuf++];
	}

	private static boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
//	private static boolean isSpaceChar(int c) { return !(c >= 32 && c <= 126); }
	private static int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }

	private static double nd() { return Double.parseDouble(ns()); }
	private static char nc() { return (char)skip(); }

	private static String ns()
	{
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while(!(isSpaceChar(b))){
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private static char[] ns(int n)
	{
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while(p < n && !(isSpaceChar(b))){
			buf[p++] = (char)b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private static char[][] nm(int n, int m)
	{
		char[][] map = new char[n][];
		for(int i = 0;i < n;i++)map[i] = ns(m);
		return map;
	}

	private static int[] na(int n)
	{
		int[] a = new int[n];
		for(int i = 0;i < n;i++)a[i] = ni();
		return a;
	}

	private static int ni()
	{
		int num = 0, b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private static long nl()
	{
		long num = 0;
		int b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private static void tr(Object... o) { if(INPUT.length() != 0)System.out.println(Arrays.deepToString(o)); }
}


import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;
import static java.lang.Math.*;

/* spar5h */

public class Main implements Runnable{

	public void run() {

		InputReader s = new InputReader(System.in);
		PrintWriter w = new PrintWriter(System.out);

		char[] a = s.next().toCharArray();

		int n = a.length;

		int count = 0;
		long res = 0;

		for(int i = 0; i < n; i++) {

			if(a[i] == 'B')
				count++;

			else
				res += count;
		}

		w.println(res);

		w.close();
	}

	static class InputReader {

		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		public int read() {

			if (numChars==-1)
				throw new InputMismatchException();

			if (curChar >= numChars) {

				curChar = 0;

				try {
					numChars = stream.read(buf);
				}
				catch (IOException e) {
					throw new InputMismatchException();
				}

				if(numChars <= 0)
					return -1;
			}

			return buf[curChar++];
		}

		public String nextLine() {

			BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
			String str = "";

			try {
	            str = br.readLine();
	        }
	        catch (IOException e) {
	            e.printStackTrace();
	        }

	        return str;
		}

		public int nextInt() {

			int c = read();

			while(isSpaceChar(c))
				c = read();

			int sgn = 1;

			if (c == '-') {
				sgn = -1;
				c = read();
			}

			int res = 0;

			do {
				if(c<'0'||c>'9')
					throw new InputMismatchException();

				res *= 10;
				res += c - '0';
				c = read();
			}
			while (!isSpaceChar(c));

			return res * sgn;
		}

		public long nextLong() {

			int c = read();

			while (isSpaceChar(c))
				c = read();

			int sgn = 1;

			if (c == '-') {
				sgn = -1;
				c = read();
			}

			long res = 0;

			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();

				res *= 10;
				res += c - '0';
				c = read();
			}

			while (!isSpaceChar(c));
				return res * sgn;
		}

		public double nextDouble() {

			int c = read();

			while (isSpaceChar(c))
				c = read();

			int sgn = 1;

			if (c == '-') {
				sgn = -1;
				c = read();
			}

			double res = 0;

			while (!isSpaceChar(c) && c != '.') {

				if (c == 'e' || c == 'E')
					return res * Math.pow(10, nextInt());

				if (c < '0' || c > '9')
					throw new InputMismatchException();

				res *= 10;
				res += c - '0';
				c = read();
			}

			if (c == '.') {

				c = read();
				double m = 1;
				while (!isSpaceChar(c))
				{
					if (c == 'e' || c == 'E')
						return res * Math.pow(10, nextInt());
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					m /= 10;
					res += (c - '0') * m;
					c = read();
				}
			}

			return res * sgn;
		}

		public String readString() {

			int c = read();

			while (isSpaceChar(c))
				c = read();

			StringBuilder res = new StringBuilder();

			do {
				res.appendCodePoint(c);
				c = read();
			}
			while (!isSpaceChar(c));

			return res.toString();
		}

		public boolean isSpaceChar(int c) {

			if (filter != null)
				return filter.isSpaceChar(c);

			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public String next() {
			return readString();
		}

		public interface SpaceCharFilter {
			public boolean isSpaceChar(int ch);
		}

	}

	public static void main(String args[]) throws Exception {
		new Thread(null, new Main(),"Main",1<<26).start();
	}
}


import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax
    static final int INF = 1_000_000_000; // 10^9
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		String[] s = saori.nextHayami().split("");
		int ans = 0;
		int count = 0;
		for(int i = 0;i < s.length;i++){
			if(s[i].equals("W")){
				ans += i-count;
				count++;
			}
		}
		System.out.println(ans);
		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() {
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) {
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() {
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }

}


import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax
    static final int INF = 1_000_000_000; // 10^9
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		String[] s = saori.nextHayami().split("");
		int ans = 0;
		int count = 0;
		for(int i = 0;i < s.length;i++){
			if(s[i].equals("W")){
				ans += (i-count);
				count++;
			}
		}
		System.out.println(ans);
		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() {
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) {
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() {
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }

}


import java.util.Scanner;

public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){

			String S = scan.next();
			char[]s = S.toCharArray();

			int count = 0;
			int kosuu = 0;
			for(int i = s.length-1;i>=0;i--) {

				int youso = s.length-1;
				if(s[i]=='B') {
					count+=(youso-i-kosuu);
					kosuu++;
				}
			}

			System.out.println(count);

		}

	}

}


#include <stdio.h>
int main(void){
  char s[200010] = {0};
  long long c = 0, b = 0;
  fgets(s, 200010, stdin);
  for(int i = 0; s[i] != 0 && s[i] != '\n'; i++){
    if(s[i] == 'B'){
      b++;
    }else{
      c += b;
    }
  }
  printf("%lld\n", c);
  return 0;
}


#include <stdio.h>
#include <string.h>

char arr[1000000];

int main() {
    scanf("%s", arr);

    long long cb = 0, t = 0;
    for (char *p = arr; *p != '\0'; p++) {
        t += *p == 'W' ? cb : 0;
        cb += *p == 'B';
    }

    printf("%lld\n", t);
}


#include <iostream>

int main(void){
    int b = 0, ans = 0;
    std::string S;
    std::cin >> S;

    for (char c: S){
        if (c == 'B'){
            ++b;
        } else {
            ans += b;
        }
    }

    std::cout << ans << std::endl;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define MOD 1000000007
const int INF = 1LL<<30;

int main(){
    string s;
    cin>>s;
    int n=s.size();
    int ans=0,tmp=0;
    rep(i,n){
        if(s[i]=='B') tmp++;
        else ans+=tmp;
    }

    cout<<ans<<endl;
}


#include <iostream>
#include <vector>
#include<algorithm>
#include<string>
#include<stdio.h>
#include<map>
#include<math.h>
#include<queue>
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int MOD = 1000000007;
const int mod = 1000000007;
const int INF = 1000000001;
const long long LINF = 1e18;
const int MAX = 510000;

int main() {
	int cnt = 0, ans = 0;
	string s;
	cin >> s;
		for(int i=0;i<s.size();i++){
			if (s[i] == 'W') {
				ans += i - cnt;
				cnt++;
		}
		}
		cout << ans << endl;
		return 0;

	}


#include <stdio.h>
#include <string.h>
typedef long long ll;

int len;
char str[200005];

int main()
{
    ll ans = 0;
    ll dist = 0;

    scanf("%s", str);
    len = strlen(str);

    for (int i = 0; i < len; i++) {
        if (str[i] == 'W') {
            ans += dist;
        }
        else {
            dist++;
        }
    }

    printf("%lld\n", ans);

    return 0;
}


#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <ctype.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>

#define N_MAX (100)
#define P_MAX (100)
#define DP_ARRAY_SIZE (N_MAX * P_MAX / 32 + 1)

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABS(a) ((a) < 0 ? -(a) : (a))
#define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))

int compare_f(const void *a, const void *b) {
	return *((int64_t *)a) < *((int64_t *)b) ? -1 : 1;
}

int compare_f2(const void *a, const void *b) {
	return *((uint64_t *)a) > *((uint64_t *)b) ? -1 : 1;
}

static size_t comb(const size_t n, const size_t r) {
	size_t result = 1;

	for (size_t i = 0; i < r; i++) {
		result *= n - i;
		result /= i + 1;
	}

	return result;
}

static uint64_t combU64(const uint64_t n, const uint64_t r) {
	uint64_t result = 1;

	for (uint64_t i = 0; i < r; i++) {
		result *= n - i;
		result /= i + 1;
	}

	return result;
}

static uint64_t gcd(uint64_t m, uint64_t n)
{
	uint64_t temp;

	while (m%n != 0) {
		temp = n;
		n = m % n;
		m = temp;
	}

	return n;
}

static char S[200001];

int main(void) {
	scanf("%s", S);

	const size_t len = strlen(S);

    size_t wCount = 0;
    uint64_t sum = 0;
    for (size_t ofs = 0; ofs < len; ofs++) {
        if (S[len - ofs - 1] == 'W') {
            wCount++;
        }
        else {
            sum += (uint64_t)wCount;
        }
    }

    printf("%"PRIu64, sum);

	return 0;
}


#include <stdio.h>

int main(int argc, char *argv[])
{
    char S[(int)(2e5 + 1)];
    long long b = 0, ans = 0;
    char *s = S;

    gets(S);

    do {
        if (*s == 'B') b++;
        else ans += b;
    } while (*(++s));

    printf("%lld\n", ans);

    return 0;
}


#include <stdio.h>
#include <string.h>
int main(void){
  char cc[1000000]={};
  gets(cc);

  int wnum=0;
  long int sumpos=0;

  for(int i=0;i<strlen(cc);i++){
      if(cc[i]=='W'){
          wnum++;
          sumpos+=i;
      }
  }

  printf("%ld\n",sumpos-(wnum*(wnum-1))/2);

  return 0;
}


#include <stdio.h>
#include <string.h>
int main(void){
  char cc[1000000]={};
  gets(cc);

  int wnum=0;
  int sumpos=0;

  for(int i=0;i<strlen(cc);i++){
      if(cc[i]=='W'){
          wnum++;
          sumpos+=i;
      }
  }

  printf("%d\n",sumpos-(wnum*(wnum-1))/2);

  return 0;
}


#include <stdio.h>
#include <string.h>
int main(void){
  char cc[1000000];
  gets(cc);

  int wnum=0;
  int sumpos=0;

  for(int i=0;i<strlen(cc);i++){
      if(cc[i]=='W'){
          wnum++;
          sumpos+=i;
      }
  }

  printf("%d\n",sumpos-(wnum*(wnum-1))/2);

  return 0;
}


function main(input){
    lines = input;

    var count=0;
    var cou=0;
    var t = lines.length;
    for(var i=0;i<t;i++){
        var a=lines.charAt(i);
        if(a=="W"){
            count+=cou;
        }else{cou++;}
    }

    console.log(count);
}

main(require('fs').readFileSync('/dev/stdin','utf8'));


function myout(text){console.log(text);}//standard output
function Main(input) {
	//input = parseInt(input);
	//input = input.split(" ");
	//input = input.split("\n");
	//input = input.split(" ").map((a)=>Number(a));
	//input = input.split("\n").map((a)=>Number(a));
  var output = 0;
  var count = 0;
  for(var i = 0; i < input.length; i++){
    var tmp = input.slice(i,i+1);
    if(tmp == "B"){
       count++;
    }else{
      output += count;
    }
  }
  myout(output);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());


function Main(input) {
  input = input.split("\n");
  S= input[0].split("");
  var ans =0
  var n=0
  var w=0
  for(i=0;i<S.length;i++){
    if(S[i]=="W"){
      ans+=i-n;
      n++;
    }
  }
  console.log('%s', ans);
}

// "実行する"ボタンを押した時に実行される関数 (デバッグ用)
function debug(){
  var input = document.getElementById("input").value;
  Main(input);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <list>

using namespace std;
typedef long long ll;
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define all(x) x.begin(),x.end()

int main()
{
   string s;cin>>s;
   int n = s.size();
   reverse(all(s));
   int cnt=0, res=0;
   rep(i,n){
       if(s[i]=='W')++cnt;
       else res+=cnt;
   }
   cout<<res<<endl;
}


inp = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n')
S = inp.shift().split('')
cnt = 0
b = []
l = 0
for(i=0;i<S.length;i++) {
    if (S[i] == 'B') {
        b.push(i)
    } else {
        l = i
    }
}
for(i=0;i<b.length;i++) {
    cnt += l - b[i] - (b.length - i - 1)
}
console.log(cnt)


inp = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n')
S = inp.shift().split('')
cnt = 0
i = 0
j = S.length - i
b = 1
f = 0
while(i<j) {
    if (S[i]== 'B') {
        if (S[i+1] == 'W') {
            S[i] = 'W'
            S[i+1] = 'B'
            cnt++
        }
    } else {
        if (b) {
            f++
        }
    }
    i++
    if (i==j) {
        i = f
        j--
    }
}
console.log(i,j,cnt)


package main

import (
        "bufio"
        "fmt"
        "os"
)

func solution(s string) int {
        c := 0
        out := 0
        for i := 0; i < len(s); i++ {
                if s[i] == 'B' {
                        c++
                } else {
                        out += c
                }
        }
        return out
}

func main() {
        var fp *os.File = os.Stdin
        reader := bufio.NewReaderSize(fp, 1024)
        s := readLine(reader)
        fmt.Println(solution(s))
}

func readLine(reader *bufio.Reader) string {
        buf := make([]byte, 0, 1024)

        for {
                l, p, _ := reader.ReadLine()

                buf = append(buf, l...)

                if !p {
                        break
                }
        }
        return string(buf)
}


package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)
var rdr = bufio.NewReaderSize(os.Stdin, 100000)

func init() {
	sc.Split(bufio.ScanWords)
}

func main() {
	s := readLine()

	ans := int64(0)
	cnt := 0
	for i, ch := range s {
		if ch == 'W' {
			ans += int64(i - cnt)
			cnt++
		}
	}

	fmt.Println(ans)
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func readLine() string {
	buf := make([]byte, 0, 100000)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func nextI64() int64 {
	sc.Scan()
	i, e := strconv.ParseInt(sc.Text(), 10, 64)
	if e != nil {
		panic(e)
	}
	return i
}

func max(a int, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a int, b int) int {
	if a < b {
		return a
	}
	return b
}

func anser(b bool, y string, n string) string {
	if b {
		return y
	}
	return n
}


package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	sc.Split(bufio.ScanWords)
	s := nextMega()

	ans := 0
	for i, r := len(s)-1, len(s)-1; i >= 0 && r >= 0; i-- {
		if s[i] == 'B' {
			ans += r - i
			r--
		}
	}
	puts(ans)
	wt.Flush()
}

var (
	sc  = bufio.NewScanner(os.Stdin)
	rdr = bufio.NewReaderSize(os.Stdin, 1000000)
	wt  = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func nextFloat64s(n int) []float64 {
	slice := make([]float64, n)
	for i := 0; i < n; i++ {
		slice[i] = nextFloat64()
	}
	return slice
}

func nextMega() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, _ := rdr.ReadLine()
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func putf(format string, a ...interface{}) {
	fmt.Fprintf(wt, format, a...)
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}


package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func nextFloat64() float64 {
	sc.Scan()
	i, e := strconv.ParseFloat(sc.Text(), 64)
	if e != nil {
		panic(e)
	}
	return i
}

func nextString() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(nil, 100000000)

	s := nextString()
	n := len(s)

	ss := make([]int, n)
	for i, v := range s {
		if v == 'B' {
			ss[i] = 1 // Black
		} else {
			ss[i] = 0 // White
		}
	}

	tmp := 0
	ans := 0
	for i := 0; i < n; i++ {

		if ss[i] == 1 {
			if tmp == -1 {
				tmp = i
			}
		} else {
			if tmp > -1 {
				l := ss[0:tmp]
				m := ss[tmp : i+1]

				r := make([]int, len(ss)-i-1)
				copy(r, ss[i+1:])

				m = append(m[len(m)-1:], m[:len(m)-1]...)

				ans += len(m) - 1
				i = i - (len(m) + 1)
				if i < 0 {
					i = 0
				}

				mid := append(m, r...)

				ss = append(l, mid...)
			}
			tmp = -1
		}
	}
	fmt.Println(ans)
}


package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func nextFloat64() float64 {
	sc.Scan()
	i, e := strconv.ParseFloat(sc.Text(), 64)
	if e != nil {
		panic(e)
	}
	return i
}

func nextString() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(nil, 100000000)

	s := nextString()
	n := len(s)

	ss := make([]int, n)
	for i, v := range s {
		if v == 'B' {
			ss[i] = 1 // Black
		} else {
			ss[i] = 0 // White
		}
	}

	tmp := 0
	ans := 0
	for i := 0; i < n; i++ {
		if tmp == 1 && ss[i] == 0 {
			ss[i-1] = 0
			ss[i] = 1
			if i > 1 {
				i -= 2
			}
			ans++
			tmp = 0
		}
		if ss[i] == 1 {
			tmp = 1
		} else {
			tmp = 0
		}
	}
	fmt.Println(ans)
}


package main

import (
	"bufio"
	"fmt"
	"os"
)

var rdr = bufio.NewReaderSize(os.Stdin, 1000000)

func readLine() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func main() {
	//sc.Split(bufio.ScanWords)
	S := readLine()

	fmt.Printf("%d\n", AGC029A(S))
}

// AGC029A ...
func AGC029A(S string) int {
	res := 0

	tail := len(S) - 1
	for i := tail; i >= 0; i-- {
		if S[i] == 'W' {
			tail = i
			break
		}
	}

	for i := 0; i < len(S); i++ {
		if S[i] == 'B' {
			res += tail - i
			tail--
		}
	}

	return res
}


s = gets.chomp.bytes
w = 'W'.ord
ans = 0
wc = 0
s.size.pred.downto(0) do |i|
  if s[i] == w
    wc += 1
  else
    ans += wc
    wc -= 0
    wc = 0 if wc < 0
  end
end
puts ans


s = gets.chomp
count = tmp = 0

s.each_char do |c|
  c == 'W' ? count += tmp : tmp += 1
end

puts count


r=k=0;gets.chars{|c|c==?W?r+=k:k+=1};p r


s = gets.chomp.split("")
ookisa = s.size
i = 1
count = 0
until i == ookisa
    if s[i] == "W" && s[i-1] == "B"
        s[i] = "B"
        s[i-1] = "W"
        count += 1
        if i >= 2
        i -= 1
        end
    else
        i += 1
    end
end
puts count


s = gets.chomp!.split("")
N = s.length
count = 0
left_w_count = 0
num_of_w = s.count("W")

loop do
  left_w_count = s.index("B")
  (left_w_count..N - 1).each do |i|
    # pp "DEBUG:i=#{i}"
    if s[i] == "B" and s[i + 1] == "W"
      s[i] = "W"
      s[i + 1] = "B"
      count += 1
      flag = 0
      #   pp "DEBUG:s=#{s}"
      break
    end
  end
  break if left_w_count == num_of_w
end

puts count


s = gets.chomp!.split("")
N = s.length
count = 0
loop do
  flag = 1
  (N - 1).times do |i|
    if s[i] == "B" and s[i + 1] == "W"
      s[i] = "W"
      s[i + 1] = "B"
      count += 1
      flag = 0
    end
  end
  break if flag == 1
end

puts count


use std::io::*;
use std::str::FromStr;
use utils::*;

pub fn main() {
    let i = stdin();
    let mut o = Vec::new();
    run(i.lock(), &mut o);
    stdout().write_all(&o).unwrap();
}

fn run<R: BufRead, W: Write>(i: R, o: &mut W) {
    let mut i = CpReader::new(i);
    let s: Vec<bool> = i
        .read_line()
        .as_bytes()
        .iter()
        .map(|&x| x == b'W')
        .collect();

    writeln!(o, "{}", solve(&s)).unwrap();
}
fn solve(s: &[bool]) -> usize {
    let mut result = 0;
    let mut blacks = 0;
    for &s in s {
        if s {
            result += blacks;
        } else {
            blacks += 1;
        }
    }
    result
}

mod utils {
    use super::*;

    pub struct CpReader<R: BufRead> {
        r: R,
        s: String,
    }

    macro_rules! fn_read {
        { $f:ident($($t:ident),*) } => {
            #[allow(dead_code)]
            pub fn $f<$($t: FromStr),*>(&mut self) -> ($($t),*) {
                let i = &mut self.read_line().split(' ');
                ($(read_next::<$t,_>(i)),*)
            }
        };
    }

    impl<R: BufRead> CpReader<R> {
        pub fn new(r: R) -> Self {
            CpReader {
                r: r,
                s: String::new(),
            }
        }
        pub fn read_line(&mut self) -> &str {
            self.s.clear();
            self.r.read_line(&mut self.s).unwrap();
            self.s.trim()
        }

        fn_read! { read2(T1, T2) }
        fn_read! { read3(T1, T2, T3) }
        fn_read! { read4(T1, T2, T3, T4) }
        fn_read! { read5(T1, T2, T3, T4, T5) }
    }
    fn read_next<'a, T: FromStr, I: Iterator<Item = &'a str>>(i: &mut I) -> T {
        i.next().unwrap().parse().ok().unwrap()
    }

}


#![allow(unused_imports)]

use std::cmp::{max, min};
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
use std::io::stdin;
use std::ops::*;
use std::process::exit;
use std::str::FromStr;

fn main() {
    let s = input::<String>().chars().collect::<Vec<_>>();
    let mut w = 0;
    let mut ans = 0;
    for (i, c) in s.iter().enumerate() {
        if *c == 'W' {
            ans += i - w;
            w += 1;
        }
    }

    println!("{}", ans);
}

pub fn input<T: FromStr>() -> T {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().ok().unwrap()
}

pub fn input_vec<T: FromStr>() -> Vec<T> {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim()
        .split_whitespace()
        .map(|x| x.parse().ok().unwrap())
        .collect::<Vec<_>>()
}

pub fn input_lines<T: FromStr>(l: usize) -> Vec<T> {
    let mut res = Vec::new();
    for _i in 0..l {
        res.push(input());
    }
    res
}

pub fn input_lines_two<T: FromStr, U: FromStr>(l: usize) -> Vec<(T, U)> {
    let mut res = Vec::new();
    for _i in 0..l {
        res.push(input_two());
    }
    res
}

pub fn input_lines_three<T: FromStr, U: FromStr, V: FromStr>(l: usize) -> Vec<(T, U, V)> {
    let mut res = Vec::new();
    for _i in 0..l {
        res.push(input_three());
    }
    res
}

pub fn input_two<T: FromStr, U: FromStr>() -> (T, U) {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    let s: Vec<&str> = buf.split_whitespace().collect();
    (
        s[0].parse::<T>().ok().unwrap(),
        s[1].parse::<U>().ok().unwrap(),
    )
}

pub fn input_three<T: FromStr, U: FromStr, V: FromStr>() -> (T, U, V) {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    let s: Vec<&str> = buf.split_whitespace().collect();
    (
        s[0].parse::<T>().ok().unwrap(),
        s[1].parse::<U>().ok().unwrap(),
        s[2].parse::<V>().ok().unwrap(),
    )
}

pub fn input_four<T: FromStr, U: FromStr, V: FromStr, W: FromStr>() -> (T, U, V, W) {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    let s: Vec<&str> = buf.split_whitespace().collect();
    (
        s[0].parse().ok().unwrap(),
        s[1].parse().ok().unwrap(),
        s[2].parse().ok().unwrap(),
        s[3].parse().ok().unwrap(),
    )
}


use std::io::stdin;
use std::str::FromStr;

fn read_line<T>() -> Vec<T>
where
    T: FromStr,
    <T as std::str::FromStr>::Err: std::fmt::Debug,
{
    let mut s = String::new();
    stdin().read_line(&mut s).ok();
    s.trim()
        .split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect()
}

fn main() {
    let mut s = String::new();
    stdin().read_line(&mut s).ok();
    let s: Vec<char> = s.trim().chars().collect();

    let mut cum_cnt: usize = 0;
    let mut res: usize = 0;
    for s_i in s {
        if s_i == 'B' {
            cum_cnt += 1;
        } else if s_i == 'W' {
            res += cum_cnt;
        }
    }
    println!("{}", res);
}


use proconio::input;

fn main() {
    input!(s: String);

    let mut b = s.len();
    let mut ans = 0;

    for i in (0..s.len()).rev() {
        if s.chars().nth(i).unwrap() == 'B' {
            ans += b - i - 1;
            b -= 1;
        }
    }

    println!("{}", ans);
}


#[allow(dead_code)]

pub struct Scanner {
    idx: usize,
    buf: Vec<String>,
}

impl Scanner {
    pub fn new<T: std::io::Read>(inf: &mut T) -> Scanner {
        Self {
            idx:0,
            buf: {
                let mut s = String::new();
                inf.read_to_string(&mut s).expect("I/O error");
                s.split_whitespace().map(|x| x.to_owned()).collect()
            },
        }
    }

    pub fn read<T: std::str::FromStr> (&mut self) -> T
    where
        <T as std::str::FromStr>::Err: std::fmt::Debug,
    {
        if self.empty() {
            panic!("reached the end of input")
        }
        let ret = self.buf[self.idx].parse::<T>().expect("parse error");
        self.idx += 1;
        return ret;
    }

    pub fn empty(&self) -> bool {
        return self.idx >= self.buf.len();
    }
}

fn main() {
    let mut sc = Scanner::new(&mut std::io::stdin());
    let s: Vec<char> = sc.read::<String>().chars().collect();
    let n = s.len();
    let mut ans = 0;
    let mut cnt = 0;

    for i in 0..n {
        if s[i] == 'W' {
            ans += cnt;
        }
        else {
            cnt += 1;
        }
    }

    println!("{}", ans);
}


#![allow(non_snake_case)]
#![allow(unused_imports)]
#![allow(dead_code)]

use proconio::{input, fastout};
use proconio::marker::*;
use whiteread::parse_line;
use std::collections::*;
use num::*;
use num_traits::*;
use superslice::*;
use std::ops::*;

use itertools::Itertools;
use itertools_num::ItertoolsNum;

#[fastout]
fn solve() {
    const MOD: usize = 1_000_000_007;
    const INF: usize = std::usize::MAX;

    input!{
        mut s: Chars
    }
    let n = s.len();
    let mut ans = 0;

    let mut idx = 0;

    while idx < n-1 {
        let substr = s[idx..=idx+1].iter().collect::<String>();

        if &substr != "BW" {
            idx += 1;
            continue;
        }

        ans += 1;
        s[idx] = 'W';
        s[idx+1] = 'B';

        if idx != 0 {
            idx -= 1;
        }
    }

    println!("{}", ans);
}

fn main() {
    solve()
}

#[cfg(test)]
mod test {
    use super::solve;
}


var cnt=0;print(readLine()!.characters.reduce(0){$0+($1<"W" ? ++cnt*0:cnt)})


import Foundation

var S = readLine()!
var ans = 0

while let range = S.rangeOfString("BW") {
    S = S.stringByReplacingCharactersInRange(range, withString: "WB")
    ans += 1
}

print(ans)


"use strict";
const Main = (input) =>{
   let xs = input.trim().split(' ');
   let S = xs.toString();

   let count = 0;
   let ans = 0;

   for(let i=0; i<S.length; i++){
      if(S.charAt(i)=='B'){
      count++;
      //console.log(count);
      }else{
      ans += count;
       //console.log(ans);
      }
   }
    console.log(ans);

}
Main(require('fs').readFileSync('/dev/stdin','utf8'));


s=require('fs').readFileSync('/dev/stdin','utf8').split('')
r = c = 0
for (i = 0; i < s.length; i++) {
	if(s[i] == 'W') {
		r += c
	} else {
		c++
	}
}
console.log(r)


import * as fs from "fs";

let S = fs.readFileSync("/dev/stdin", "utf8").trim();

// BWBWBW = 6
let position = S.length-1;
let answer = 0;
for(let i=S.length-1; i>=0; i--) {
    if (S[i] == 'B') {
        answer += position-i;
        position -= 1;
    }
}
console.log(answer);


s=require('fs').readFileSync('/dev/stdin','utf8').split('')
r = c = 0
for (i = 0; i < s.length; i++) {
	console.log(s[i])
	if(s[i] == 'W') {
		r += c
	} else {
		c++
	}
}
console.log(r


s=require('fs').readFileSync('/dev/stdin','utf8').split('')
r = c = 0
for (i = 0; i < s.length; i++) {
	if(s[i] == "W") {
		r += c
	} else {
		c++
	}
}
console.log(c)


s=require('fs').readFileSync('/dev/stdin','utf8').split('')
r = c = 0
l = s.length
for (i = 0; i < t; i++) {
	if(s[i] == "W") {
		r += c
	} else {
		c++
	}
}
console.log(c)


from sys import stdin
import math

N, D = stdin.readline().rstrip().split()

input_line = int(N)
dis = int(D)
cnt = 0

for i in range(input_line):
	s = stdin.readline().rstrip().split()
	X = int(s[0])
	Y = int(s[1])
	result = math.sqrt(X**2 + Y**2)

	# print(result)

	if result <= dis :
		cnt += 1

print(cnt)


from sys import stdin

N, D = stdin.readline().rstrip().split()
DD = int(D) ** 2
N = int(N)

CNT = 0

for i in range(N):
  X, Y = stdin.readline().rstrip().split()
  XX = int(X) ** 2
  YY = int(Y) ** 2
  ZZ = XX + YY
  if ZZ <= DD:
    CNT += 1

print(CNT)


import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N,D=MI()
    D2=D**2
    ans=0
    for i in range(N):
        x,y=MI()
        d2=(x**2+y**2)
        if d2 <= D2:
            ans+=1

    print(ans)

main()


import math

n, d = int(input().split())
count = 0

for i in range(n):
    xn, yn = int(input().split())
    if d >= math.sqrt(xn ** 2 + yn ** 2):
        count += 1

print(count)


N, D = map(int, input().split())

X = [0] * N
Y = [0] * N

for i in range(N):
    X[i], Y[i] = map(int, input.split())

count = 0

for i in range(N):
    if(D**2 >= X[i]**2 + Y[i]**2):
        count += 1

print(count)


n, d = map(int, input().split())
x = [list(map(int,input().split())) for i in range(n)]

ans = 0
for i,j in x:
    if (i**2)+(j**2)) <= d**2:
        ans += 1

print(ans)


import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;

public class Main {
    public static void main(String args[] ) throws Exception {
        Reader sc=new Reader();
        PrintWriter out=new PrintWriter(System.out);
        int n=sc.nextInt();
        Double D=sc.nextDouble();
        int count=0;
        for(int i=0;i<n;i++){
            long x=sc.nextLong(),y=sc.nextLong();
            double d=Math.sqrt(x*x+y*y);
            if(d<=D){
                count++;
            }
        }
        out.println(count);
        out.flush();
    }
}

class Reader
    {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader()
        {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException
        {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException
        {
            byte[] buf = new byte[64]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1)
            {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException
        {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do
            {
                ret = ret * 10 + c - '0';
            }  while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException
        {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException
        {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();

            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');

            if (c == '.')
            {
                while ((c = read()) >= '0' && c <= '9')
                {
                    ret += (c - '0') / (div *= 10);
                }
            }

            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException
        {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException
        {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException
        {
            if (din == null)
                return;
            din.close();
        }
    }


import java.io.*;
import java.util.*;

public class Main implements Runnable {

    static InputReader in;
    static PrintWriter w;

    // static boolean head = false;

    public static void main(String[] args) throws Exception {

        new Thread(null, new Main(), "Main", 1 << 26).start();

        // head = false;
        // Thread t1 = new Thread(null, new Main(), "Main", 1 << 26);
        // t1.start();
        // t1.join();
        // if (head)
        // throw new Exception();
    }

    public void run() {
        try {
            in = new InputReader(System.in);
            w = new PrintWriter(System.out);
            int n = in.nextInt();
            long d = in.nextLong();
            d = d * d;
            int count = 0;
            for (int i = 0; i < n; i++) {
                long x = in.nextLong();
                long y = in.nextLong();
                x = x * x;
                y = y * y;
                if (d >= x + y)
                    count++;
            }
            w.println(count);
            w.close();
        } catch (Exception e) {
            // head = true;
            w.println("Error" + "\n");
            e.printStackTrace();
            w.close();
            System.exit(0);
        }
    }

    static class InputReader {

        private final InputStream stream;
        private final byte[] buf = new byte[8192];
        private int curChar, snumChars;
        private SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int snext() {
            if (snumChars == -1)
                throw new InputMismatchException();
            if (curChar >= snumChars) {
                curChar = 0;
                try {
                    snumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (snumChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = snext();
            while (isSpaceChar(c)) {
                c = snext();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = snext();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = snext();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public long nextLong() {
            int c = snext();
            while (isSpaceChar(c)) {
                c = snext();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = snext();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = snext();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public int[] nextIntArray(int n) {
            int a[] = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = this.nextInt();
            }
            return a;
        }

        public long[] nextLongArray(int n) {
            long a[] = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = this.nextLong();
            }
            return a;
        }

        public String readString() {
            int c = snext();
            while (isSpaceChar(c)) {
                c = snext();
            }
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = snext();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public String nextLine() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = snext();
            } while (!isEndOfLine(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        private boolean isEndOfLine(int c) {
            return c == '\n' || c == '\r' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }
}


import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;

public class Main {
	static class Reader
    {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader()
        {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException
        {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException
        {
            byte[] buf = new byte[(int) (2e6+10)]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1)
            {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException
        {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do
            {
                ret = ret * 10 + c - '0';
            }  while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException
        {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException
        {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();

            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');

            if (c == '.')
            {
                while ((c = read()) >= '0' && c <= '9')
                {
                    ret += (c - '0') / (div *= 10);
                }
            }

            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException
        {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException
        {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException
        {
            if (din == null)
                return;
            din.close();
        }
    }

	public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
	public static Reader sc = new Reader();

	public static List<Integer>[] edges;

	public static void main(String[] args) throws IOException{

		int n = sc.nextInt();
		long d =sc.nextLong();
		d*=d;
		int cnt = 0;
		for(int i=0;i<n;++i) {
			long x = sc.nextLong();
			long y = sc.nextLong();
			if(x*x + y*y <= d) ++cnt;
		}
		out.print(cnt);

	out.close();
	}

}


import java.util.Scanner;

public class Main{
  public static void main(String args[]){
  Scanner scanner = new Scanner(System.in);
   int n = scanner.nextInt();
   double d = scanner.nextInt();
   //System.out.println(d);
   int x[];
   int y[];
   int cnt = 0;
   x = new int[n];
   y = new int[n];
   double z = 0;
    for(int i=0;i<n;i++){
     x[i] = scanner.nextInt();
     y[i] = scanner.nextInt();
     z = (double)Math.sqrt(x[i]*x[i]+y[i]*y[i]);
  //System.out.println(z);
     //if(Math.sqrt(x[i]*x[i]+y[i]*y[i])<=d){
     if(z<=d){
          cnt++;
          //System.out.println(d + " " + z);
     }else{
     }
   }
  System.out.println(cnt);
  }
}


import java.util.Scanner;

public class Main{
  public static void main(String args[]){
  Scanner scanner = new Scanner(System.in);
   int n = scanner.nextInt();
   int d = scanner.nextInt();
   int x[];
   int y[];
   int cnt = 0;
   x = new int[n];
   y = new int[n];
   for(int i=0;i<n;i++){
     x[i] = scanner.nextInt();
     y[i] = scanner.nextInt();
     if(Math.sqrt(x[i]*x[i]+y[i]*y[i])<=d){
          cnt++;
     }else{
     }
   }
  System.out.println(cnt);
  }
}


import java.util.*;
import java.io.*;
import java.lang.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int d = sc.nextInt();
        int ans = 0;

        for (int i = 0; i<n ; i++){
            float x = sc.nextFloat();
            float y = sc.nextFloat();

            double area = Math.sqrt( (x*x) + (y*y) );
            if (area<=d)
                ans++;
        }

        System.out.println(ans);
    }
}


#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
#include<cstring>

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int CM = 1 << 17, CL = 10;
char cn[CM + CL], * ci = cn + CM + CL, * owa = cn + CM, ct;
const ll ma0 = 1157442765409226768;
const ll ma1 = 1085102592571150095;
const ll ma2 = 71777214294589695;
const ll ma3 = 281470681808895;
const ll ma4 = 4294967295;
inline int getint() {
	if (ci - owa > 0) {
		memcpy(cn, owa, CL);
		ci -= CM;
		fread(cn + CL, 1, CM, stdin);
	}
	if (*ci == '-') ci++;
	ll tmp = *(ll*)ci;
	int dig = 68 - __builtin_ctzll((tmp & ma0) ^ ma0);
	tmp = tmp << dig & ma1;
	tmp = tmp * 10 + (tmp >> 8) & ma2;
	tmp = tmp * 100 + (tmp >> 16) & ma3;
	tmp = tmp * 10000 + (tmp >> 32) & ma4;
	ci += (72 - dig >> 3);
	return tmp;
}

int main() {
	//cin.tie(0);
	//ios::sync_with_stdio(false);

	ll N = getint(), D = getint();
	D = D * D;

	int kotae = 0;
	rep(i, N) {
		ll X = getint(), Y = getint();
		kotae += (D >= X * X + Y * Y);
	}
	printf("%lld\n", kotae);

	Would you please return 0;
}


#include<cstdio>
#include<iostream>
#include<string>
#include<algorithm>
#include<stdio.h>
#include<locale.h>
#include<math.h>
#include<set>
#include<stack>
#include<queue>
using namespace std;
int main()
{
int n,d,x,y,ans=0;
scanf("%d %d",&n,&d);
for(int i=0;i<n;i++)
{
 scanf("%d %d",&x,&y);
 if((x*x+y*y)<=d*d){ans++;}
}
printf("%d",ans);
}


#include <iostream>
#include <algorithm>
#include <string>
#include <vector>

using namespace std;
typedef long long ll;

int main()
{
	int n, d, x, y, ans = 0;
	cin >> n >> d;
	for (int i = 0; i < n; i++) {
		cin >> x >> y;
		if (x * x + y * y <= d * d) {
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}


#include<cstdio>
#include<iostream>
#include<string>
#include<algorithm>
#include<stdio.h>
#include<locale.h>
#include<math.h>
#include<set>
#include<stack>
#include<queue>
using namespace std;
int main()
{
int n,d,x,y,ans=0;
scanf("%d %d",&n,&d);
for(int i=0;i<n;i++)
{
 scanf("%d %d",&x,&y);
 if(x(*x+y*y)<=d*d){ans++;}
}
printf("%d",ans);
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void){
	int N,D;
	int i,ans;
	char str[100000];

	fgets(str, sizeof(str), stdin);
	N=atoi(strtok(str," "));
	D=atoi(strtok(NULL," "));

	ans=0;
	for(i=0;i<N;i++){
		int x,y;
		fgets(str, sizeof(str), stdin);
		x=atoi(strtok(str," "));
		y=atoi(strtok(NULL," "));
		if( ((long long)x*x+(long long)y*y) <= ((long long)D*D) ) ans++;
	}

	printf("%d\n",ans);

	return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void) {
	const char *SEP = " ";
	long long int n, d, sq_d, x, y, cnt = 0;
	char input_str[256];
	char *num_str;
	int i;

	fgets(input_str, sizeof(input_str), stdin);
	num_str = strtok(input_str, SEP);
	n = atoi(num_str);
	num_str = strtok(NULL, SEP);
	d = atoi(num_str);

	sq_d = d * d;
	for ( i = 0; i < n; i++ ) {
		fgets(input_str, sizeof(input_str), stdin);
		num_str = strtok(input_str, SEP);
		x = atoi(num_str);
		num_str = strtok(NULL, SEP);
		y = atoi(num_str);

		if ( (x*x) + (y*y) <= sq_d ) {
			cnt++;
		}
	}

	printf("%d\n", cnt);

	return 0;
}


#include <stdio.h>

int main(){
  int n;
  long long d;
  scanf("%d%lld",&n,&d);
  int ans = 0,i=0;
  for(i;i<n;++i){
    long long x,y;
    scanf("%lld%lld",&x,&y);
    if(x*x+y*y<=d*d)ans++;
  }
  printf("%d\n",ans);
  return 0;
}


#include<stdio.h>
int main(){
	int N,D,x,y,n=0;
	scanf("%d %d",&N,&D);
	for(int i=0;i<N;i++){
		scanf("%d %d",&x,&y);
		if(x*x+y*y<=D*D)
		n++;
	}
	printf("%d\n",n);
}


#include<stdio.h>
int main(){
	int N,D,x,y,n=0;
	scanf("%d %d",&N &D);
	for(int i=0;i<N;i++){
		scanf("%d %d",&x,&y);
		if(x*x+y*y<=D*D)
		n++;
	}
	printf("%d\n",n);
}


#include<stdio.h>
int main(){
	int N,D,x,y,n=0;
	scanf("%d",&N &D);
	for(int i=0;i<N;i++){
		scanf("%d %d",&x,&y);
		if(x*x+y*y<=D*D)
		n++;
	}
	printf("%d\n",n);
}


"use strict";
var input=require("fs").readFileSync("/dev/stdin","utf8");
var cin=input.split(/ |\n/),cid=0;
function next(){return +cin[cid++];}
function nextstr(){return cin[cid++];}
function nextbig(){return BigInt(cin[cid++]);}
function nexts(n,a){return a?cin.slice(cid,cid+=n):cin.slice(cid,cid+=n).map(a=>+a);}
function nextm(h,w,a){var r=[],i=0;if(a)for(;i<h;i++)r.push(cin.slice(cid,cid+=w));else for(;i<h;i++)r.push(cin.slice(cid,cid+=w).map(a=>+a));return r;}
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill().map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill().map(x=>"+r+")";return eval(r);}

var myOut = main();
if(myOut !== undefined)console.log(String(myOut));

function main(){
  var n = next(), d = next();
  var ans = 0;
  var dd = d*d;
  for(var i = 0; i < n; i++){
    var x = next(), y = next();
    if(x*x + y*y <= dd)ans++;
  }
  return ans;
}


function Main(input) {
    input = input.split("\n");
    const nd = input[0].split(" ");
    const n = parseInt(nd[0], 10);
    const d = parseInt(nd[1], 10);

    let count = 0;
    for(let i = 1; i <= n; i++) {
        const xy = input[i].split(" ");
        const x = parseInt(xy[0], 10);
        const y = parseInt(xy[1], 10);

        const r = Math.sqrt(x ** 2 + y ** 2);
        if(r <= d) {
            count++;
        }
    }

    console.log(count);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


'use strict'

const main = (INPUT) => {
  const input = INPUT.split('\n')
  const [N, D] = input[0].split(' ')
  let ans = 0
  for (let i = 1; i < input.length; i++) {
    const [X, Y] = input[i].split(' ')
    if (Math.sqrt(X ** 2 + Y ** 2) <= D) {
      ans++
    }
  }
  console.log(ans)
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))


const main = (stdin) => {
    const input = stdin.split("\n");
    const init = input[0].split(' ');

    let c = 0;
  	for(let i=1;i<parseInt(init[0]);i++) {
	  const xy = input[i].split(' ');
	  if(Math.sqrt((parseInt(xy[0])^2) + (parseInt(xy[1])^2)) <= parseInt(init[1])) c++;
    }
  console.log(c);

}

main(require("fs").readFileSync("/dev/stdin", "utf8"));


const main = (stdin) => {
    const input = stdin.split("\n");
    const init = input[0].split(' ');

    let c = 0;
  	for(let i=1;i<Number(init[0]);i++) {
	  const xy = input[i].split(' ');
	  if(Math.sqrt((Number(xy[0])^2) + (Number(xy[1])^2)) <= Number(init[1])) c++;
    }
  console.log(c);

}

main(require("fs").readFileSync("/dev/stdin", "utf8"));


const main = (stdin) => {
    const input = stdin.split("\n");
    const { count, distance } = Number(input[0].split(' '));

    let c = 0;
  	for(let i=1;i<count;i++) {
	  const { x, y } = input[i].split(' ');
	  if(Math.sqrt(x^2 + y^2) <= distance) c++;
    }
  console.log(c);

}

main(require("fs").readFileSync("/dev/stdin", "utf8"));


package main

import (
	. "fmt"
	"os"
)

// github.com/EndlessCheng/codeforces-go
func main() {
	buf := make([]byte, 4096)
	_i := len(buf)
	rc := func() byte {
		if _i == len(buf) {
			os.Stdin.Read(buf)
			_i = 0
		}
		b := buf[_i]
		_i++
		return b
	}
	r := func() (x int) {
		b := rc()
		neg := false
		for ; '0' > b ; b = rc() {
			if b == '-' {
				neg = true
			}
		}
		for ; '0' <= b; b = rc() {
			x = x*10 + int(b&15)
		}
		if neg {
			return -x
		}
		return
	}
	n,d,s :=r(),r(),0
	d*=d
	for ; n > 0; n-- {
		if x,y:=r(),r(); x*x+y*y <= d {
			s++
		}
	}
	Print(s)
}


package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)

	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())
	sc.Scan()
	d, _ := strconv.Atoi(sc.Text())

	var ans int
	for i := 0; i < n; i++ {
		sc.Scan()
		f, _ := strconv.Atoi(sc.Text())
		sc.Scan()
		s, _ := strconv.Atoi(sc.Text())
		if d >= int(math.Ceil(math.Sqrt(float64((f*f)+(s*s))))) {
			ans++
		}

	}
	fmt.Println(ans)
}


package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func newInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func main() {

	var n, cnt, d int
	sc.Split(bufio.ScanWords)
	n = newInt()
	d = newInt()
	d = d * d
	for i := 0; i < n; i++ {
		x := newInt()
		y := newInt()
		if x*x+y*y <= d {
			cnt++
		}
	}
	fmt.Println(cnt)
}


package main

import (
	"bufio"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextFloat() float64 {
	sc.Scan()
	v, _ := strconv.ParseFloat(sc.Text(), 64)
	return v
}

func nextInt() int64 {
	sc.Scan()
	v, _ := strconv.ParseInt(sc.Text(), 10, 64)
	return v
}

func main() {
	sc.Split(bufio.ScanWords)
	N := int(nextInt())
	D := nextFloat()
	ans := 0
	for i := 0; i < N; i++ {
		x := nextFloat()
		y := nextFloat()
		if x * x + y * y <= D * D {
			ans += 1
		}
	}
	println(ans)
}


package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
  	"strings"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
  	p := strings.Split(scanner.Text())
	n, _ := strconv.Atoi(p[0])
	d, _ := strconv.Atoi(p[1])
	result := 0
	for i := 0; i < n; i++ {
		scanner.Scan()
      	p = strings.Split(scanner.Text())
		x, _ := strconv.Atoi(p[0])
		y, _ := strconv.Atoi(p[1])
      	v := int(math.Cbrt(float64(x*x + y*y)))
		if v < d {
			result++
		}
	}
	fmt.Println(result)
}


package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	p := strconv.Atoi(scanner.Text())
	n, _ := strconv.Atoi(p[0])
	d, _ := strconv.Atoi(p[1])
	result := 0
	for i := 0; i < n; i++ {
		scanner.Scan()
		p = strconv.Atoi(scanner.Text())
		x, _ := strconv.Atoi(p[0])
		y, _ := strconv.Atoi(p[1])
      	v := int(math.Cbrt(float64(x*x + y*y)))
		if v < d {
			result++
		}
	}
	fmt.Println(result)
}


N,d,*P = $<.read.split.map &:to_i
D = d*d
p P.each_slice(2).count {|x,y| x*x + y*y <= D }


n,d=gets.split.map &:to_i
p$<.count{|e|x,y=e.split.map &:to_i
x*x+y*y<=d*d}


N,D = gets.split.map(&:to_i)
p $<.count{|ln|
	x,y = ln.split.map(&:to_i)
	x*x+y*y <= D*D
}


n,d=gets.split.map &:to_i
p$<.map{|e|x,y=e.split.map &:to_i
x*x+y*y<=d*d}


num, score = gets.chomp.split.map(&:to_i)
ans = 0
(1..num).each do |n|
  sum = gets.chomp.split.map(&:to_i).map{ |n| n**2}.sum
  if score**2 <= sum
    ans += 1
  end
end
puts ans


n,d = gets.split.map(&:to_i)
cnt = 0
for i in 0...n
  a,b = gets.split.map(&:to_i)
  if a*a+b*b<=d
    cnt += 1
  end
end

puts cnt


#[allow(unused_imports)]
use itertools::Itertools;
#[allow(unused_imports)]
use num::Integer;
#[allow(unused_imports)]
use proconio::derive_readable;
use proconio::fastout;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::cmp;
#[allow(unused_imports)]
use std::collections::*;

#[fastout]
fn main() {
    input! {
        n: usize,
        d: i64,
        ps: [(i64, i64); n],
    }
    let ans = ps
        .into_iter()
        .filter(|&(x, y)| x * x + y * y <= d * d)
        .count();

    println!("{}", ans);
}


use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: usize,
        d: usize,
        p: [(isize, isize); n],
    }

    let mut ans = 0;
    for (x, y) in p {
        if x.pow(2) + y.pow(2) <= d.pow(2) as isize {
            ans += 1;
        }
    }
    println!("{}", ans);
}


use proconio::input;

fn main() {
    input! {
        n: usize,
        d: i64,
        xy: [(i64, i64); n],
    };
    let ans = xy
        .iter()
        .filter(|(x_i, y_i)| x_i*x_i + y_i*y_i <= d*d)
        .count();
    println!("{}", ans);
}


use proconio::input;

fn main() {
    input! {
        count: i32,
        target: i32,
        points: [(i32, i32); count]
    }

    let mut result = 0;
    for (x, y) in points {
        let distance = (((x*x) + (y*y)) as f64).sqrt();

        if target as f64 >= distance {
            result += 1;
        }
    }

    println!("{}", result);
}


use std::io::*;
use std::str::FromStr;

fn main() {
    let n: u32 = read();
    let d: u32 = read();
    let mut count: u32 = 0;
    for i in 0..n {
        let x: i32 = read();
        let y: i32 = read();
        let tmp = x.pow(2) + y.pow(2);
        if (tmp as f32).sqrt() <= (d as f32) {
            count+=1
        }
    }
    println!("{}", count)
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}


use proconio::{input};

fn main() {
    input! [
	N: i32,
	D: f32,
    ];

    let mut ans = 0;
    for i in 0..N {
	input![
	    X: f32,
	    Y: f32,
	];
	let tmp = X * X + Y * Y;
	let dist = tmp.sqrt();
	if dist <= D {
	    ans += 1;
	}
    }
    println!("{}", ans);
}